package objects
{
	/**
	 * @author rob.thurston
	 */
	public class SwitchDoor extends AbstractObject
	{
		[Embed(source="../assets/assets.swf", symbol="SwitchDoor")]
		protected var ReactorDoorClass : Class;
		
		private var _size : Number;
		private var _isVertical : Boolean;
		private var _open : Boolean;
		private var _topLeftSwitch : Boolean;

		public function SwitchDoor(yOffset : Number)
		{
			super(yOffset);

			_asset = new ReactorDoorClass();
			addChild(_asset);
		}
		
		public function set size(laserSize : Number) : void
		{
			_size = laserSize;
			_asset.rotation = 0;
			_asset.width = laserSize;
		}
		
		public function set open(isOpen : Boolean) : void
		{
			_open = isOpen;
		}
			
		public function set vertical(isVertical : Boolean) : void
		{
			_isVertical = isVertical;
			_asset.rotation = (isVertical) ? 90 : 0;
		}
		
		public function set topLeftSwitch(isTopLeftSwitch : Boolean) : void
		{
			_topLeftSwitch = isTopLeftSwitch;
			_asset.scaleY = (isTopLeftSwitch) ? -1 : 1; 
		}
		
		override public function getCode() : String
		{
			var code : String = "";
			code = "[self addSwitchDoor:ccp(" + x + "," + (_yOffset - y) + ") size:" + _size + " isOpen:" + _open + " isVertical:" + _isVertical + " topLeftSwitch:" + _topLeftSwitch + "]";
			
			return code;
		}
	}
}
